package com.xnsy.jishexiangmu.mapper;

import com.xnsy.jishexiangmu.pojo.LunTan;
import com.xnsy.jishexiangmu.pojo.PingLun;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LunTanMapper {
    @Select("select * from luntan")
    List<LunTan> get();
    @Update("update luntan set dianzan = dianzan+1 where id = #{id}")
    void addDianZan(Integer id);
    @Insert("insert into luntan(username,title,contain,create_time)" +
            "values(#{username},#{title},#{contain},now())")
    void addMessage(LunTan lunTan);
    @Select("select * from luntan where id = #{id}")
    LunTan getOne(Integer id);
    @Select("select  * from pinglun where pid = #{pid}")
    List<PingLun> getPingLun(Integer pid);
    @Insert("insert into pinglun(username,pid,contain,create_time)" +
            "values (#{username},#{pid},#{contain},now())")
    void addPinglun(PingLun pingLun);
}
